#pragma once
#include <QLabel>
#include <QMouseEvent>
#include <QDebug>
#include <QPainter>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>

enum
{
    MOVE,
    PEN,
    V,
    SH,
    EDGE,
    DRAW_RECT,
    DRAW_CYC
};

QImage sharpen(QImage origin, int k=5);
QImage blur(QImage origin, int h = 0, int w = 0, int x = 0, int y = 0);
QImage saturation(int delta, QImage origin);


class ImageLabel : public QLabel {
public:
    void initCanvas();
    void setPainter();
    void setType(int t);
    void saveImage(QString& path);
    void setImage(QString& path);
    void setImage(const QImage im);
    void updateImage();
    void updateCanvas();
    void paintImage();
    void paintImage(QImage image1);
    QImage getImage();
    void clear();
protected:
    void mousePressEvent(QMouseEvent* ev);
    void mouseReleaseEvent(QMouseEvent* ev);
    void mouseMoveEvent(QMouseEvent* ev);
private:
    QImage image;
    QImage canvas;
    QImage canvas_pen;
    QPoint imagepos;
    int type=0;
    QPoint last_pos;
    QPoint draw_pos;
    QPainter* p;
private slots:

};


